repo.or.cz
/
andmenj-acm.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Solving 10385 - Duathlon (Ternary search)
[andmenj-acm.git]
/
11526 - H(n)
/
11526.2.cpp
blob
3787112f44bc66792ebcb42cb34e83944e43865c
1
#include <iostream>
2
#include <cstdio>
3
using namespace
std
;
4
5
int
n
;
6
int
main
(){
7
int
t
;
scanf
(
"%d"
, &
t
);
8
while
(
t
-- &&
scanf
(
"%d"
, &
n
)==
1
){
9
if
(
n
<=
0
){
puts
(
"0"
);
continue
; }
10
11
long long
res
=
0
;
12
unsigned int
i
=
1
;
13
while
(
i
<=
n
){
14
int
k
=
n
/
i
;
15
int
j
=
n
/
k
;
16
if
(
k
<=
0
||
j
<=
0
||
i
<=
0
)
for
(;;);
17
res
+=
1LL
* (
j
-
i
+
1
) *
k
;
18
i
=
j
+
1
;
19
}
20
printf
(
"%lld
\n
"
,
res
);
21
}
22
return
0
;
23
}